package com.school.campus.domain;

import java.util.Date;

import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.school.common.annotation.Excel;
import com.school.common.core.domain.BaseEntity;

/**
 * 单聊消息（存储一对一文字消息）对象 messages
 *
 * @author wwj
 * @date 2025-11-07
 */
public class Messages extends BaseEntity {
    private static final long serialVersionUID = 1L;

    /**
     * 消息ID（主键）
     */
    private Long id;

    /**
     * 所属会话ID（关联conversations.id）
     */
    @Excel(name = "所属会话ID", readConverterExp = "关=联conversations.id")
    private Long conversationId;

    /**
     * 发送者ID（关联sys_user.user_id）
     */
    @Excel(name = "发送者ID", readConverterExp = "关=联sys_user.user_id")
    private Long senderId;

    /**
     * 消息内容（纯文字）
     */
    @Excel(name = "消息内容", readConverterExp = "纯=文字")
    private String content;

    /**
     * 发送时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @Excel(name = "发送时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
    private Date sendTime;

    /**
     * 接收者是否已读：0=未读，1=已读
     */
    @Excel(name = "接收者是否已读：0=未读，1=已读")
    private Long isRead;

    public void setId(Long id) {
        this.id = id;
    }

    public Long getId() {
        return id;
    }

    public void setConversationId(Long conversationId) {
        this.conversationId = conversationId;
    }

    public Long getConversationId() {
        return conversationId;
    }

    public void setSenderId(Long senderId) {
        this.senderId = senderId;
    }

    public Long getSenderId() {
        return senderId;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public String getContent() {
        return content;
    }

    public void setSendTime(Date sendTime) {
        this.sendTime = sendTime;
    }

    public Date getSendTime() {
        return sendTime;
    }

    public void setIsRead(Long isRead) {
        this.isRead = isRead;
    }

    public Long getIsRead() {
        return isRead;
    }

    @Override
    public String toString() {
        return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
                .append("id", getId())
                .append("conversationId", getConversationId())
                .append("senderId", getSenderId())
                .append("content", getContent())
                .append("sendTime", getSendTime())
                .append("isRead", getIsRead())
                .toString();
    }
}
